<template>
	<view>
		<navbar></navbar>
		<view class="container">
			<!-- <view class="Top_tilte">
				账户管理
			</view> -->
			<view class="List_entrance">
				<view class="List_item"  v-for="(item,index) in ClickList" :key='index' :class=" index != 5 ? 'Bottom_boder' : ''" @tap.stop.prevent="NavRouter(index)" >
					<view v-if="item == '连连钱包管理' && !isOpenStatus.is_open_lianlian">
						{{item}}
						<text style="color: #D7B05A;">
							(去开户)
						</text>
					</view>
					<view v-else-if="item == '杉德钱包管理' && !isOpenStatus.is_open_sande">
						{{item}}
						<text style="color: #D7B05A;">
							(去开户)
						</text>
					</view>
					<view v-else>
						<view v-if="item == '连连钱包管理' || item == '杉德钱包管理'">
							<text style="font-weight: 600;">
								{{item}}
							</text>
						</view>
						<view class="" v-else>
							{{item}}
						</view>
						
					</view>
					<view class="icon">
						<image src="@/static/images/user/icon_right.png" mode=""></image>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const app = getApp();
	export default {
		data() {
			return {
				isOpenStatus: uni.getStorageSync("isOpenStatus"),
				// #ifdef APP-PLUS
				ClickList: ['安全密码管理','连连支付密码管理', '连连银行卡管理', '连连钱包管理','杉德钱包管理','地址管理']
				// #endif
				// #ifndef APP-PLUS
				ClickList: ['安全密码管理','连连支付密码管理', '连连银行卡管理', '连连钱包管理','杉德钱包管理','地址管理']
				// #endif
				
			};
		},
		/**
		 * 生命周期函数--监听页面加载
		 */
		onLoad(options) {
			console.log(this.isOpenStatus)
		},
		onPullDownRefresh() {
			uni.stopPullDownRefresh();
		},
		methods:{
			/**
			 * 点击列表跳转
			 * index：对应索引
			 */
			
			NavRouter(index){
				// #ifdef APP-PLUS
				console.log(index)
				if(index == 0){
				 	uni.navigateTo({
				 		url: `../setting/security`
				 	});
				 }else if(index == 1){
					plus.runtime.openURL(`https://www.btcys.com/pages/user/modify/index?token=${123}`)
				 }else if(index == 2){
					plus.runtime.openURL(`https://www.btcys.com/pages/user/bank/bank?token=${123}`)
				 }else if(index == 3){
					if(this.isOpenStatus.is_open_lianlian){
						uni.navigateTo({
							url: `../wallet/index`
						});
					}else{
						uni.showModal({
							title: '请前往H5页面开户'
						})
						plus.runtime.openURL(`https://api.btcys.com/#/pages/user/realName/index?token=${123}`)
					}
				}else if(index == 4){
					// 杉德钱包
					app._post_form('user/getSanDeWallet', {}, function(result) {
						console.log(result)
						if (1 == result.code) {
							app.navigationTo(result.data.pay_url)
						}else{
							app.showError(result.msg);
						}
					}, null, function() {
						// 解除按钮禁用
						app.showError(result.msg);
					});
				}else if(index == 5){
					uni.navigateTo({
						url: `../addressManagement/index`
					});
				}
				// #endif
				// #ifndef APP-PLUS
				console.log(index)
				if(index == 0){
					uni.navigateTo({
						url: `../setting/security`
					});
				}else if(index == 1){
				 	uni.redirectTo({
				 		url: `../modify/index`
				 	});
				 }
				 else if(index == 2){
					uni.redirectTo({
						url: `../bank/bank`
					});
				}
				else if(index == 3){
					if(this.isOpenStatus.is_open_lianlian){
						uni.navigateTo({
							url: `../wallet/index`
						});
					}else{
						uni.navigateTo({
							url: `../realName/index`
						});
					}
					
				}else if(index == 4){
					app._post_form('user/getSanDeWallet', {}, function(result) {
						console.log(result)
						if (1 == result.code) {
							app.navigationTo(result.data.pay_url)
						}else{
							app.showError(result.msg);
						}
					}, null, function() {
						// 解除按钮禁用
						app.showError(result.msg);
					});
				}else if(index == 5){
					uni.navigateTo({
						url: `../addressManagement/index`
					});
				}
				// #endif
				
			}
		}
	}
</script>

<style lang="scss">
	.container {
		height: 100vh;
	}
	.Bottom_boder{
		border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
	}

	.Top_tilte {
		margin-top: 40rpx;
		width: 100%;
		height: 80rpx;
		background-color: #FFFFFF;
		text-align: center;
		color: rgba(0, 0, 0, 0.9);
		font-size: 30rpx;
		font-family: 'dy-iconfont';
		font-weight: bold;
		line-height: 80rpx;
	}

	.List_entrance {
		margin: 0 30rpx;
		margin-top: 50rpx;
		border-radius: 20rpx;
		background-color: #FFFFFF;
		box-shadow: 0rpx 4rpx 6rpx 1rpx rgba(0, 0, 0, 0.02);
		padding: 0 30rpx;

		.List_item {
			height: 100rpx;
			background-color: #FFF;
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-size: 28rpx;
			font-weight: 400;
			color: rgba(0, 0, 0, 0.9);
			.icon{
				width: 32rpx;
				height: 32rpx;
				image{
					width: 100%;
					height: 100%;
				}
			}
		}
		
		
	}
</style>
